Terratronic

Image Display Lib 1.1 (Delphi) (Release 004)

License	Register	Note	Contact	Feedback

The Image Display Lib 1.1 (Delphi) contains several components which lets you display images in a very easy way. All the most important image file formats are supported: BMP, DIB, GIF, JPG, PCD, PCX, SCR, TIF. The components offer resize and fade in/out functions. The conversion and displaying routines are written in C/C++ and are exported to Dynamic Link Libraries (DLLs). That is the reason why this library is so compact and very fast.

TttDisplayImage

The TttDisplayImage component loads and displays graphical images. The images can be resized to fit the client area of the control. The component offers fade in/out functions.

TttDisplayImageScroll

If your image is too big and you do not want to resize it, use the TttDisplayImageScroll component. This component adds horizontal and vertical scrollbars to the image.

TttImageToDIB

The TttImageToDIB component is a nonvisual component. It converts graphical images to Device Independent Bitmaps (DIBs).

TttDisplayDIB

The TttDisplayDIB component is a nonvisual component. It draws Device Independent Bitmaps (DIBs) on output devices. The component also supports resize and fade in/out functions.


Register

Only US$ 49.00 for an unlimited, royalty-free license!

Image Display Lib 1.1 (Delphi) is not free software. You have the right to test the Trial Version for 30 days. Afterwards you have to register (buy a license) or to remove the whole package from your computer.

All the orders will be processed by PSL (Public Software Library). Only credit-card orders are available (Master Card/Eurocard, Visa, American Express and Discover).

Your email and billing addresses are very important, because PSL will send a license key number to those addresses. This license key you have to enter into the LicenseKey property. If you do not receive your license key number within a few, please send an email message to 'admin@terratronic.com'.

The address and fax number listed below are for questions regarding orders only.

Ordering online:

1. 	Go to our web site at 'www.terratronic.com'.

2. 	Click on 'Ordering'.

Ordering by email:

1.	Copy the order form to your mail application.

2. 	Fill out the order form.

3. 	Send it to '30766@pslweb.com'.

Ordering by fax:

1.	Print the order form.

2.	Fill out the order form.

3.	Fax to 713-524-6398 (USA).

Ordering by snail mail:

1. 	Print the order form.

2. 	Fill out the order form.

3. 	Send your mail to the following address:

PSL

P.O.Box 35705, Houston, TX 77235-5705.


Order Form

TERRATRONIC

Image Display Lib 1.1 (Delphi)

PSL # 30766

Quantity	Product	Unit	Amount	Total

..............	Image Display Lib 1.1 (Delphi)	US$	49.--	....................

==========

Shipping Name and Address

First/Middle Name:	______________________________________________

Last Name:	______________________________________________

Company Name:	______________________________________________

Address 1:	______________________________________________

Address 2:	______________________________________________

City:	____________________   ZIP/Postal Code:  _________

State/Province:	____________________   (for the U.S. and Canada only)

Country:	______________________________________________

Phone:	______________________________________________

E-Mail:	______________________________________________

Credit Card

[ ] Mastercard/Eurocard     [ ] Visa     [ ] American Express     [ ] Discover

Card Number:  _________________________   Expiration Date:  __________

BANK's name and phone number from the back of the card

(for AMEX, just enter 'AMEX')

_______________________________________________________________

Credit Card Holder's Name and Address

(only if different from the Shipping Name and Address)

First/Middle Name:	______________________________________________

Last Name:	______________________________________________

Company Name:	______________________________________________

Address 1:	______________________________________________

Address 2:	______________________________________________

City:	____________________   ZIP/Postal Code:  _________

State/Province:	____________________   (for the U.S. and Canada only)

Country:	______________________________________________

Operating System

[ ]   Windows 95

[ ]   Windows 98

[ ]   Windows NT

Where did you hear about 'Image Display Lib 1.1 (Delphi)'?

_______________________________________________________________


License
License Agreement

By using Image Display Lib 1.1 (Delphi), you (either an individual or a legal entity) acknowledge that you have read this license agreement, understand it, and agree to the terms. This license shall supersede any proposal or prior agreement, oral or written, as well as any other communication between us relating to the subject matter of this license agreement. If you do not understand or agree to the terms of this license agreement, promptly remove the whole software package, the associated documentation, and any copies created.

Copyright

This software is written and owned by Guido Amrein, Switzerland. It is protected by the copyright laws of Switzerland, international treaty provisions, and all other national or international laws.

Trial Version

Image Display Lib 1.1 (Delphi) is not free Software. You have the right to test the Trial Version for 30 days. Afterwards you have to register (buy a license) or to remove the whole package from your computer.

You are not allowed to distribute applications based on components/libraries of Image Display Lib 1.1 (Delphi), whether gratis or for a fee, unless the TERRATRONIC License is executed and associated license fees are paid.

You may distribute the Trial Version of Image Display Lib 1.1 (Delphi) through normal shareware channels in any medium (CD-ROMs, BBSs, Internet etc.). You always have to transmit the whole, unchanged package for free. You may only charge a fee for the physical act of transferring.

Full Version

After paying the registration fee, TERRATRONIC grants you a royalty-free, nonexclusive license to distribute your applications based on components/libraries of Image Display Lib 1.1 (Delphi).

Trial Version and Full Version

You are not allowed to reverse-engineer, decompile, or disassemble the software.

You may not attempt to unlock or bypass any copy protection or authentication algorithms utilized by the software.

You are not allowed to remove or modify any copyright notice.

Limited Warranty

We give no warranty for Image Display Lib 1.1 (Delphi) to fit any given purpose. If any parts of the software is erroneous, we give no warranty for costs you may have through using Image Display Lib 1.1 (Delphi).

Liability Disclaimer

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAWS, IN NO EVENT SHALL TERRATRONIC BE RESPONSIBLE FOR ANY AND ALL LIABILITY FOR SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, LOSS OF SAVINGS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING FROM THE USE OR OPERATION OF THE SOFTWARE OR FROM THE INABILITY TO USE THE SOFTWARE, EVEN IF TERRATRONIC HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THE ENTIRE RISK AS TO THE USE OF THIS PRODUCT IS ASSUMED BY THE USER AND/OR LICENSEE.

Terms

This license is effective until terminated. You may terminate it by destroying the whole software package, the associated documentation, and any copies created. Without prejudice to any other rights, TERRATRONIC may terminate this license agreement if you fail to comply with the terms or conditions of this agreement. In such an event, you must destroy the whole software package, the associated documentation, and any copies created.


Contacting the developer
Contact

If you have administration problems, suggestions, complaints etc, use the following email address:

admin@terratronic.com

If you need support for any of our products, use the following email address:

support@terratronic.com

If you want to get into contact with the programmer Guido Amrein, use the following email address:

gamrein@terratronic.com


Image File Formats

Image Display Lib 1.1 (Delphi) supports the following image file formats:

Format	Extension	Driver
Windows Bitmap	*.bmp	ttBMP32.dll
OS/2 Bitmap	*.bmp	ttBMP32.dll
Windows DIB (Device Independent Bitmap)	*.dib	ttBMP32.dll
OS/2 DIB (Device Independent Bitmap)	*.dib	ttBMP32.dll
Graphics Interchange Format (Compuserve)	*.gif	ttGIF32.dll
JPEG Format (Joint Photographic Experts Group)	*.jpg, *.jif, *.jpeg	ttJPG32.dll
Photo CD Format (Kodak)	*.pcd	ttPCD32.dll
Paintbrush Format (ZSoft)	*.pcx	ttPCX32.dll
Capture files of Word 5.x (Microsoft)	*.scr	ttPCX32.dll
Tag Image File Format (Aldus)	*.tif, *.tiff	ttTIF32.dll


TttDisplayImage

The TttDisplayImage component loads and displays graphical images. The images can be resized to fit the client area of the control. The component offers fade in/out functions. If your image is to big and you do not want to resize it, use the TttDisplayImageScroll component instead of the TttDisplayImage component.

Properties	Methods	Events
Align	FadeIn	OnClick
BackgroundColor	FadeOut	OnDblClick
CenterImage	GetImageWidth	OnDragDrop
Cursor	GetImageHeight	OnDragOver
DragCursor	GetColorDepth	OnEndDrag
DragMode	HideImage	OnFadeEnd
FadeSpeed	IsValidImage	OnFadeStart
FileName	LoadImage	OnHideImage
FitIn	ShowImage	OnLoadEnd
Height		OnLoadStart
HelpContext		OnMouseDown
Hint		OnMouseMove
ImageTypes		OnMouseUp
Left		OnShowImage
LicenseKey		OnStartDrag
Name
PopupMenu
ShowError
ShowHint
Tag
Top
Width


BackgroundColor property

Applies to

TttDisplayImage

TttDisplayImageScroll

Declaration

property BackgroundColor: TColor;

Description

The BackgroundColor property determines the background color of the image control. The default value is clBlack.

Example

ttDisplayImage1.BackgroundColor:=clWhite;


CenterImage property

Applies to

TttDisplayImage

TttDisplayImageScroll

Declaration

property CenterImage: Boolean;

Description

The CenterImage property specifies whether an image is centered in the image control. If CenterImage is set to true, the image is centered. If CenterImage is set to false, the image aligns with the top left corner of the control. The default value is true.

Example TttDisplayImage

ttDisplayImage1.CenterImage:=true;

See also:

FitIn property (not available in the component TttDisplayImageScroll)


FadeSpeed property

Applies to

TttDisplayImage

TttDisplayDIB

Declaration

TFadeSpeedRange = 1..5;

property FadeSpeed: TFadeSpeedRange;

Description

The value of the FadeSpeed property determines how far an image is fading in/out. A value of 1 causes a very slow fading, a value of 5 a very fast fading. The default value is 3.

Example

ttDisplayImage1.FadeSpeed:=4;

See also:

FadeIn method

FadeOut method

OnFadeStart event

OnFadeEnd event


FileName property (TttDisplayImage, TttDisplayImageScroll)

FileName property

Applies to:

TttDisplayImage

TttDisplayImageScroll

Declaration:

property FileName: String;

Description:

The FileName property specifies the image file to be loaded by the LoadImage method.

Example:

ttDisplayImage1.FileName:='d:\images\squirrel.tif';

ttDisplayImage1.Load;

ttDisplayImage1.Show;

The code above loads the image file 'd:\images\squirrel.tif' and displays it in the control.


FitIn property

Applies to

TttDisplayImage

Declaration

TFitIn = (fiAlways,fiIfLarger,fiNever);

property FitIn: TFitIn;

Description

The FitIn property specifies if the image automatically resizes to match the size of the client area of the image control. The following values are allowed:

fiAlways	resize always

fiIfLarger	resize only if the image is larger than the client area of the image control

fiNever	resize never

The default value is fiIfLarger.

Example

ttDisplayImage1.FitIn:=fiNever;

See also:

CenterImage property


ImageTypes property

Applies to

TttDisplayImage

TttDisplayImageScroll

TttImageToDIB

Declaration

TImageTypes = set of (itBMP,itDIB,itGIF,itJPG,itPCD,itPCX,itSCR,itTIF)

property ImageTypes: TImageTypes;

Description

The ImageTypes property defines the supported image file formats in your application. Only the drivers for the supported file formats will be loaded at the start of your program. The following elements are allowed in the ImageTypes property:

Image Type	Description	Driver
itBMP	Windows and OS/2 Bitmap	ttBMP32.dll
itDIB	Windows and OS/2 DIB (Device Independent Bitmap)	ttBMP32.dll
itGIF	Graphics Interchange Format (Compuserve)	ttGIF32.dll
itJPG	JPEG Format (Joint Photographic Experts Group)	ttJPG32.dll
itPCD	Photo CD Format (Kodak)	ttPCD32.dll
itPCX	Paintbrush Format (Zsoft)	ttPCX32.dll
itSCR	Capture files of Word 5.x (Microsoft)	ttPCX32.dll
itTIF	Tag Image File Format (Aldus)	ttTIF32.dll

The ImageTypes property is a set, so it can contain multiple values.

 Important

You always have to deliver the driver files of the supported image file formats with your applications! If you do not, your programs will not work!

Example

ttDisplayImage1.ImageTypes:=[itGIF,itJPG];

Only GIF and JPG images can be displayed in your application.


IsValidImage method

Applies to

TttDisplayImage

TttDisplayImageScroll

TttImageToDIB

Declaration

function IsValidImage: Boolean;

Description

The IsValidImage method checks the file format of an image. The filename of the image is specified in the FileName property.

Return value

If the image file contains a valid format, the method returns true, otherwise false.

Example (TttDisplayImage)

ttDisplayImage1.FileName:='d:\images\beaver.tif';

if ttDisplayImage1.IsValidImage then

begin

  ttDisplayImage1.Load;

  ttDisplayImage1.Show;

end;

The code above loads and displays the image file 'd:\images\beaver.tif' only if it contains a valid format.

See also

LoadImage method (TttDisplayImage, TttDisplayImageScroll)

ConvertToDIB method (TttImageToDIB)


LoadImage method

Applies to:

TttDisplayImage

TttDisplayImageScroll

Declaration:

function LoadImage: Integer;

Description:

The LoadImage method reads the image file specified in the FileName  property and loads the data into memory. The method does not display the image. If you want to show the image, please use the ShowImage or FadeIn method afterwards. An old image will automatically be destroyed by loading a new one.

Example:

ttDisplayImage1.FileName:='d:\images\hedgehog.tif';

ttDisplayImage1.Load;

ttDisplayImage1.Show;

The code above loads the image file 'd:\images\hedgehog.tif' and shows it on the form.


ShowImage method

Applies to:

TttDisplayImage

TttDisplayImageScroll

Declaration:

procedure ShowImage;

Description:

The ShowImage method displays an image in the control. The image must be loaded by the LoadImage method first.

Example:

ttDisplayImage1.FileName:='d:\images\marmot.tif';

ttDisplayImage1.Load;

ttDisplayImage1.Show;

The code above loads the image file 'd:\images\marmot.tif' and shows it in the control.


GetImageWidth method

Applies to:

TttDisplayImage

TttDisplayImageScroll

Declaration:

function GetImageWidth: Integer;

Description:

The GetImageWidth method returns the width of the actual image. The picture must be loaded by the LoadImage method first.

Example:

ttDisplayImage1.FileName:='d:\images\gull.tif';

ttDisplayImage1.Load;

Caption:=IntToStr(ttDisplayImage1.GetImageWidth);

The code above loads the image file 'd:\images\gull.tif' and displays the width of the picture in the title bar of the window.


GetImageHeight method

Applies to:

TttDisplayImage

TttDisplayImageScroll

Declaration:

function GetImageHeight: Integer;

Description:

The GetImageHeight method returns the height of the actual image. The picture must be loaded by the LoadImage method first.

Example:

ttDisplayImage1.FileName:='d:\images\seal.tif';

ttDisplayImage1.Load;

Caption:=IntToStr(ttDisplayImage1.GetImageHeight);

The code above loads the image file 'd:\images\seal.tif' and displays the height of the picture in the title bar of the window.


GetColorDepth method (TttDisplayImage, TttDisplayImageScroll)

GetColorDepth method

Applies to:

TttDisplayImage

TttDisplayImageScroll

Declaration:

function GetColorDepth: Integer;

Description:

The GetColorDepth method returns the color depth of the actual image. The picture must be loaded by the LoadImage method first.

Possible return values:

Value	Color depth	Number of colors
1	1 bit	2
4	4 bit	16
8	8 bit	256
24	24 bit	16.8 Mio.

Example:

ttDisplayImage1.FileName:='d:\images\fox.tif';

ttDisplayImage1.Load;

Caption:=IntToStr(ttDisplayImage1.GetColorDepth);

The code above loads the image file 'd:\images\fox.tif' and displays the color depth of the picture in the title bar of the window.


HideImage method

Applies to:

TttDisplayImage

TttDisplayImageScroll

Declaration:

procedure HideImage;

Description:

The HideImage method makes an image invisible

Example:

ttDisplayImage1.Hide;


FadeIn method (TttDisplayImage)

FadeIn method

Applies to:

TttDisplayImage

Declaration:

function FadeIn: Boolean;

Description:

The FadeIn method fades an image in. At the beginning, the whole image is black. It will become lighter and lighter. The speed of the fading depends on the FadeSpeed property. The image must be loaded by the LoadImage method first.

If the function succeeds, the return value is true. If the function fails, the return value is false.

Example:

ttDisplayImage1.FadeSpeed:=2;

ttDisplayImage1.FileName:='d:\images\owl.tif';

ttDisplayImage1.Load;

ttDisplayImage1.FadeIn;

The code above loads the image file 'd:\images\owl.tif' and fades it slowly in.

See also:

FadeOut method

OnFadeStart event

OnFadeEnd event


FadeOut method (TttDisplayImage)

FadeOut method

Applies to:

TttDisplayImage

Declaration:

function FadeOut: Boolean;

Description:

The FadeOut method fades an image out. The image will become darker and darker. At the end of the fading, the image is completely black. The speed of the fading depends on the FadeSpeed property. The image must be loaded by the LoadImage method first.

If the function succeeds, the return value is true. If the function fails, the return value is false.

Example:

ttDisplayImage1.FadeOut;

See also:

FadeIn method

OnFadeStart event

OnFadeEnd event


LicenseKey property

Applies to

TttDisplayImage

TttDisplayImageScroll

TttImageToDIB

Declaration

property LicenseKey: String;

Description

As you know this is a Trial Version. You may test this software for 30 days. Afterwards you have to register (buy a license) or to remove the software from your computer.

Registered users get a license key. This key you have to enter into the LicenseKey property. You are now entitled to use this software as a full version. If you want to load an image and there is no key or a wrong key entered into the LicenseKey property, you always get an information dialog on the screen which tells you that this is only a Trial Version. If you entered the right key into the LicenseKey property, this dialog does not appear anymore.

Example (TttDisplayImage)

ttDisplayImage1.LicenseKey:='GA72AH DS73 XZ7wRQz';


TttDisplayImageScroll

The TttDisplayImageScroll component loads and displays graphical images. Use this component if your image is too big and you do not want to resize it. The component adds horizontal and vertical scrollbars to the image.

Properties	Methods	Events
Align	GetImageWidth	OnClick
BackgroundColor	GetImageHeight	OnDblClick
CenterImage	GetColorDepth	OnDragDrop
Cursor	HideImage	OnDragOver
DragCursor	IsValidImage	OnEndDrag
DragMode	LoadImage	OnHideImage
FileName	ShowImage	OnLoadEnd
Height		OnLoadStart
HelpContext		OnMouseDown
Hint		OnMouseMove
HorzScrollBar		OnMouseUp
ImageTypes		OnScrollHorz
Left		OnScrollVert
LicenseKey		OnShowImage
Name		OnStartDrag
PopupMenu
ShowError
ShowHint
Tag
Top
Tracking
VertScrollBar
Width


ShowError property

Applies to

TttDisplayImage

TttDisplayImageScroll

TttImageToDIB

Declaration

property ShowError: Boolean;

Description

The ShowError property determines if the control should display his own error dialog when an error occur. If ShowError property is set to true, the own dialog box will appear. If ShowError property is set to false, no error message will be shown. In this case, the programmer is responsible to inform the user by himself.

The default value is true.

An error box example:

Example

ttDisplayImage1.ShowError:=false;


Tracking property

Applies to:

TttDisplayImageScroll

Declaration:

property Tracking: Boolean;

Description:

The Tracking property determines whether the controll will scroll when the scroll bar thumb tab is being dragged or will wait for the tab to be dropped.

The default value is false.

Example:

ttDisplayImageScroll1.Tracking:=false;


OnLoadEnd event (TttDisplayImage, TttDisplayImageScroll)

OnLoadEnd event

Applies to:

TttDisplayImage

TttDisplayImageScroll

Declaration:

TNotifyEvent = procedure (Sender: TObject) of object;

property OnLoadEnd: TNotifyEvent;

Description:

The OnLoadEnd event occurs just after a loading process has finished. Use this event to specify any special processing you want to happen after the control has loaded an image.

See also:

LoadImage property


OnLoadStart event (TttDisplayImage, TttDisplayImageScroll)

OnLoadStart event

Applies to:

TttDisplayImage

TttDisplayImageScroll

Declaration:

TNotifyEvent = procedure (Sender: TObject) of object;

property OnLoadStart: TNotifyEvent;

Description:

The OnLoadStart event occurs just before a loading process starts. Use this event to specify any special processing you want to happen before the control loads an image.

See also:

LoadImage property


OnScrollHorz event

Applies to:

TttDisplayImageScroll

Declaration:

TImageScrollEvent = procedure(Sender: TObject; Position,MaxPos: word) of object;

property OnScrollHorz: TImageScrollEvent;

Description:

The OnScrollHorz event occurs when the horizontal scroll position has been changed.

The Position parameter indicates the position of the thumb tab on the scroll bar. The maximum value is stored in the MaxPos parameter.

See also:

OnScrollVert event


OnScrollVert event

Applies to:

TttDisplayImageScroll

Declaration:

TImageScrollEvent = procedure(Sender: TObject; Position,MaxPos: word) of object;

property OnScrollVert: TImageScrollEvent;

Description:

The OnScrollVert event occurs when the vertical scroll position has been changed.

The Position parameter indicates the position of the thumb tab on the scroll bar. The maximum value is stored in the MaxPos parameter.

See also:

OnScrollHorz event


OnFadeStart event

Applies to

TttDisplayImage

TttDisplayDIB

Declaration

TFadeKind = (fkFadeIn,fkFadeOut);

TImageFadeEvent = procedure(Sender: TObject; FadeKind: TFadeKind) of object;

property OnFadeStart: TImageFadeEvent;

Description

The OnFadeStart event occurs just before a fading process starts. Use this event to specify any special processing you want to happen before the control fades an image in or out.

Parameters

Sender:

Identifies the component which received the event.

FadeKind:

Indicates whether the image is fading in or fading out.

See also:

OnFadeEnd event

FadeIn method

FadeOut method


OnFadeEnd event

Applies to

TttDisplayImage

TttDisplayDIB

Declaration

TFadeKind = (fkFadeIn,fkFadeOut);

TImageFadeEvent = procedure(Sender: TObject; FadeKind: TFadeKind) of object;

property OnFadeEnd: TImageFadeEvent;

Description

The OnFadeEnd event occurs just after a fading process has finished. Use this event to specify any special processing you want to happen after the control faded an image in or out.

Parameters

Sender:

Identifies the component which received the event.

FadeKind:

Indicates whether the image is fading in or fading out.

See also

OnFadeStart event

FadeIn method

FadeOut method


OnShowImage event

Applies to:

TttDisplayImage

TttDisplayImageScroll

Declaration:

TNotifyEvent = procedure (Sender: TObject) of object;

property OnLoadEnd: TNotifyEvent;

Description:

The OnShowImage event occurs just after an image has become visible. Use the OnShowImage event to specify any special processing you want to happen after the image appeared.

See also:

OnHideImage event

ShowImage property

HideImage property


OnHideImage event

Applies to:

TttDisplayImage

TttDisplayImageScroll

Declaration:

TNotifyEvent = procedure (Sender: TObject) of object;

property OnLoadEnd: TNotifyEvent;

Description:

The OnHideImage event occurs just after the image has hidden. Use the OnHideImage event to specify any special processing you want to happen just after the image disappeared.

See also:

OnShowImage event

HideImage property

ShowImage property


TttImageToDIB

The TttImageToDIB component is a nonvisual component. It converts graphical images to Device Independent Bitmaps (DIBs).

Properties	Methods	Events
FileName	IsValidImage	OnConvertEnd
ImageTypes	ConvertToDIB	OnConvertStart
LicenseKey
Name
ShowError
Tag


FileName property (TttImageToDIB)

FileName property

Applies to

TttImageToDIB

Declaration

property FileName: String;

Description

The FileName property specifies the image file to be converted to a Device Independent Bitmap (DIB) by the ConvertToDIB method.

Example

ttImageToDIB1.FileName:='d:\images\lynx.tif';

hDIB:=ttImageToDIB1.ConvertToDIB;

{if you do not need the DIB anymore}

if hDIB>0 then GlobalFree(hDIB).

See also

IsValidImage method


ConvertToDIB method

Applies to

TttImageToDIB

Declaration

function ConvertToDIB: THandle;

Description

The ConvertToDIB method converts the image file specified in the FileName  property to a Device Independent Bitmap (DIB).

Return value

If the function succeeds, the return value is a valid handle of a global memory object that contains the DIB. If the function fails, the return value is zero.

 Important

If you do not need the DIB anymore, you must free the global memory object by the GlobalFree function (Windows API).

Example

ttImageToDIB1.FileName:='d:\images\duck.tif';

hDIB:=ttImageToDIB1.ConvertToDIB;

{if you do not need the DIB anymore}

if hDIB>0 then GlobalFree(hDIB).

See also

IsValidImage method


OnConvertStart event

Applies to

TttImageToDIB

Declaration

TNotifyEvent = procedure (Sender: TObject) of object;

property OnConvertStart: TNotifyEvent;

Description

The OnConvertStart event occurs just before a converting process has begun.

Parameters

Sender:

Identifies the component which received the event.

See also

OnConvertEnd event

ConvertToDIB method


OnConvertEnd event

Applies to

TttImageToDIB

Declaration

TNotifyEvent = procedure (Sender: TObject) of object;

property OnConvertEnd: TNotifyEvent;

Description

The OnConvertEnd event occurs just after a converting process has finished.

Parameters

Sender:

Identifies the component which received the event.

See also

OnConvertStart event

ConvertToDIB method


TttDisplayDIB

The TttDisplayDIB component is a nonvisual component. It draws Device Independent Bitmaps (DIBs) on output devices. The component also supports resize and fade in/out functions.

Properties	Methods	Events
FadeSpeed	FadeIn	OnFadeEnd
Name	FadeOut	OnFadeStart
Tag	GetHeight
	GetWidth
	GetColorDepth
	ShowDIB
	StretchDIB


FadeIn method (TttDisplayDIB)

FadeIn method

Applies to

TttDisplayDIB

Declaration

function FadeIn(PaintDC: HDC; hDIB: THandle; X, Y: Integer): Boolean;

Description

The FadeIn method fades a Device Independent Bitmap (DIB) on an output device in. The speed of the fading depends on the FadeSpeed property. The DIB must be loaded by the ConvertToDIB method of the TttImageToDIB component first.

Parameters

PaintDC:

Identifies the device context for the output device on which the DIB will appear.

hDIB:

Identifies the DIB.

X, Y:

Specifies the logical coordinates of the upper-left corner of the destination rectangle in which the DIB will appear.

Return value

If the function succeeds, the return value is true. If the function fails, the return value is false.

Example

ttImageToDIB1.FileName:='d:\images\swan.tif';

hDIB:=ttImageToDIB1.ConvertToDIB;

ttDisplayDIB1.FadeSpeed:=2;

ttDisplayDIB1.FadeIn(PaintBox1.Canvas.Handle,hDIB,0,0);

The code above converts the image file 'd:\images\swan.tif' in a DIB and fades it slowly on the drawing surface of the PaintBox1 component in.

See also

FadeOut method

OnFadeStart event

OnFadeEnd event


FadeOut method (TttDisplayDIB)

FadeOut method

Applies to

TttDisplayDIB

Declaration

function FadeOut(PaintDC: HDC; hDIB: THandle; X, Y: Integer): Boolean;

Description

The FadeOut method fades a Device Independent Bitmap (DIB) on an output device out. The speed of the fading depends on the FadeSpeed property. The DIB must be loaded by the ConvertToDIB method of the TttImageToDIB component first.

Parameters

PaintDC:

Identifies the device context for the output device on which the DIB will appear.

hDIB:

Identifies the DIB.

X, Y:

Specifies the logical coordinates of the upper-left corner of the destination rectangle in which the DIB will appear.

Return value

If the function succeeds, the return value is true. If the function fails, the return value is false.

Example

ttDisplayDIB1.FadeOut(PaintBox1.Canvas.Handle,hDIB,0,0);

See also

FadeIn method

OnFadeStart event

OnFadeEnd event


GetHeight method

Applies to

TttDisplayDIB

Declaration

function GetHeight(hDIB: THandle): Longint;

Description

The GetHeight method returns the height of a Device Independent Bitmap (DIB) in pixels. The DIB must be loaded by the ConvertToDIB method of the TttImageToDIB component first.

Parameters

hDIB:

Identifies the DIB.

Return value

If the function succeeds, the return value is the height of the DIB in pixels. If the function fails, the return value is zero.

Example

Caption:=IntToStr(ttDisplayDIB1.GetHeight(hDIB));

See also

GetWidth method


GetWidth method

Applies to

TttDisplayDIB

Declaration

function GetWidth(hDIB: THandle): Longint;

Description

The GetWidth method returns the width of a Device Independent Bitmap (DIB) in pixels. The DIB must be loaded by the ConvertToDIB method of the TttImageToDIB component first.

Parameters

hDIB:

Identifies the DIB.

Return value

If the function succeeds, the return value is the width of the DIB in pixels. If the function fails, the return value is zero.

Example

Caption:=IntToStr(ttDisplayDIB1.GetWidth(hDIB));

See also

GetHeight method


GetColorDepth method (TttDisplayDIB)

GetColorDepth method

Applies to

TttDisplayDIB

Declaration

function GetColorDepth(hDIB: THandle): Integer;

Description

The GetColorDepth method returns the color depth of a Device Independent Bitmap (DIB). The DIB must be loaded by the ConvertToDIB method of the TttImageToDIB component first.

Parameters

hDIB:

Identifies the DIB.

Return value

Value	Color depth	Number of colors
1	1 bit	2
4	4 bit	16
8	8 bit	256
24	24 bit	16.8 Mio.

Example

Caption:=IntToStr(ttDisplayDIB1.GetColorDepth(hDIB));

The code above displays the color depth of the specified Device Independent Bitmap (DIB) in the title bar of the window.


ShowDIB method

Applies to

TttDisplayDIB

Declaration

function ShowDIB(PaintDC: HDC; hDIB: THandle; X, Y: Integer): Boolean;

Description

The ShowDIB method displays a Device Independent Bitmap (DIB) on an output device. The DIB must be loaded by the ConvertToDIB method of the TttImageToDIB component first.

Parameters

PaintDC:

Identifies the device context for the output device on which the DIB will appear.

hDIB:

Identifies the DIB.

X, Y:

Specifies the logical coordinates of the upper-left corner of the destination rectangle in which the DIB will appear.

Return value

If the function succeeds, the return value is true. If the function fails, the return value is false.

Example

ttImageToDIB1.FileName:='d:\images\goose.tif';

hDIB:=ttImageToDIB1.ConvertToDIB;

ttDisplayDIB1.ShowDIB(PaintBox1.Canvas.Handle,hDIB,0,0);

The code above converts the image file 'd:\images\goose.tif' in a DIB and displays it on the drawing surface of the PaintBox1 component.

See also

FadeIn method

FadeOut method

StretchDIB method


StretchDIB method

Applies to

TttDisplayDIB

Declaration

function StretchDIB(hDIB: THandle; NewWidth, NewHeight: Longint): THandle;

Description

The StretchDIB method copies a Device Independent Bitmap (DIB) into an new DIB and resizes the new DIB.

Parameters

hDIB:

Identifies the source DIB.

NewWidth, NewHeight:

Specifies the new dimensions of the destination DIB.

Return value

If the function succeeds, the return value is a valid handle of a global memory object that contains the new DIB. If the function fails, the return value is zero.

 Important:

The old DIB is not freed automatically. If you do not need the old DIB anymore, you must free the global memory object of the old DIB by calling the GlobalFree function (Windows API).

Example

hNewDIB:=ttDisplayDIB.StretchDIB(hDIB,300,100);

if hNewDIB>0 then GlobalFree(hDIB);

ttDisplayDIB1.ShowDIB(PaintBox1.Canvas.Handle,hNewDIB,0,0);

The code above resizes a DIB and displays it on the drawing surface of the PaintBox1 component.

See also

ShowDIB method


 Feedback (suggestions, complaints etc.)

I spent a lot of time into developing and testing this programming library. I know that faultless software is an illusion. So if you can find any bugs, please send me a short message. This way you can help me making this tool perfect.

I am also interested in your opinion of this software. What do you think about it? Do you have any suggestions or complaints? Please let me know by sending a short email.

English is not my native language. If you can find any spelling or grammar mistakes, please inform me about them.

Thank you very much for your help.

And here is my email address:

gamrein@terratronic.com


 Note

 Important

You always have to deliver the following Dynamic Link Libraries (DLL) with your applications:

- cw3220.dll

- cw3220mt.dll

- ttDispDIB32.dll

- the driver files of the supported image file formats (ImageTypes property)